import { request } from './request';

export function getOtherConfig() {
  return request({
    url: '/other/config',
  });
}

export function login(data) {
  return request({
    url: '/login/password',
    method: 'post',
    data,
  });
}

export function getUser() {
  return request({
    url: '/member/detail',
  });
}

export function getMessage(page = 1, page_size = 20) {
  return request({
    url: `/member/messages?page=${page}&page_size=${page_size}`,
  });
}

export function getRoles() {
  return request({
    url: '/roles',
  });
}

export function getOrderList(page = 1, page_size = 10) {
  return request({
    url: `/member/orders?page=${page}&page_size=${page_size}`,
  });
}

export function getPromoCode() {
  return request({
    url: '/member/promoCode',
  });
}

export function updateAvatar(data) {
  return request({
    url: '/member/detail/avatar',
    method: 'post',
    data,
  });
}

export function getImageCode() {
  return request({
    url: '/captcha/image',
  });
}

export function getSms(data) {
  return request({
    url: '/captcha/sms',
    method: 'post',
    data,
  });
}

export function smsLogin(data) {
  return request({
    url: '/login/mobile',
    method: 'post',
    data,
  });
}
